namespace T0075WaterAlert
{
    /// <summary>
    /// Water Heater
    /// </summary>
    public class Heater
    {
        public delegate void TemperatureDelegate(int temp);
        public event TemperatureDelegate temperatureEvent;//WaterTempEvent
        public event TemperatureDelegate alarmEvent;
        private int temperature;//water temperature
        
        public void BoilWater()
        {
            for (int i = 20; i <= 100; i++)
            {
                temperature = i;
                //output temperature
                if (temperatureEvent != null)
                    temperatureEvent(temperature);
                //if water temperature >= 98
                if (temperature >= 98)
                {
                    if(temperatureEvent!=null)
                        alarmEvent?.Invoke(temperature);
                }
            }
        }
    }
}